package cn.tedu.qxhouserent.house.service.impl;

import cn.tedu.qxhouserent.commons.ex.ServiceException;
import cn.tedu.qxhouserent.commons.web.ServiceCode;
import cn.tedu.qxhouserent.house.mapper.OrientationMapper;
import cn.tedu.qxhouserent.house.pojo.vo.OrientationListItemVO;
import cn.tedu.qxhouserent.house.pojo.vo.OrientationStandardVO;
import cn.tedu.qxhouserent.house.pojo.vo.SectionStandardVO;
import cn.tedu.qxhouserent.house.service.OrientationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Slf4j
@Service
public class OrientationServiceImpl implements OrientationService {

    @Autowired
    private OrientationMapper orientationMapper;


    @Override
    public List<OrientationListItemVO> list() {
        log.debug("开始处理查询朝向详情业务,参数:无");

        return orientationMapper.list();
    }

    @Override
    public OrientationStandardVO getStandardById(Long id) {
        log.debug("开始处理【根据ID查询朝向】的业务，参数：{}", id);
        OrientationStandardVO queryResult = orientationMapper.getStandardById(id);
        if (queryResult == null) {
            String message = "查询朝向失败，数据不存在！";
            log.warn(message);
            throw new ServiceException(ServiceCode.ERR_NOT_FOUND, message);
        }
        return queryResult;
    }
}
